import prisma from "@/lib/prisma"

export const getApps = async () => {
    const data = await prisma.app.findMany()
    return data
}

export const getChatSessions = async (appId: string) => {
    const data = await prisma.chatSession.findMany({ where: { appId } })
    return data
}

export const getChatSessionById = async (id: string) => {
    const data = await prisma.chatSession.findUnique({ where: { id } })
    return data
}

export const getChatMessages = async (sessionId: string) => {
    const data = await prisma.chatMessage.findMany({ where: { sessionId } })
    return data
}